<!doctype html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <title></title> 
    <style type="text/css">
*{
	padding: 0;margin: 0;
}

    </style>
</head>
<body>
<script type="text/javascript">
	document.body.style.background = 'black';
	document.body.appendChild(document.createElement('div'));
	var div = $('div');
	div[0].style.cssText = 'width:100%;height:100%;position:absolute;background:black;';
	function $(sClass){
		return document.querySelectorAll(sClass);
	};
	createNode(15,15);

	div[0].style.transform = 'perspective(800px) rotateY(45deg)';
	div[0].style.transformStyle = 'preserve-3d'

	var center = div[0].querySelectorAll('div')[parseInt(div[0].querySelectorAll('div').length/2)]

	center.style.transform='translateZ(200px)';
	setTimeout(function(){
		center.style.transition='1s all ease';

		center.style.transform='translateZ(0px)';
		setTimeout(function(){
			var allDiv = div[0].querySelectorAll('div');
			for(var i =0;i < allDiv.length;i++){
				allDiv[i].style.transition = (Math.random()*1.8 + 0.2)+'s all ease';
				allDiv[i].style.transform = 'perspective(800px) translateZ('+(Math.random()*400 - 200)+'px) rotateY('+(Math.random()*360 - 180)+'deg) rotateX('+(Math.random()*360 - 180)+'deg)';
				allDiv[i].style.opacity = 0;
			}
		},1000);

	},1);

	function createNode(w,y){
		var R = w,W = y;
		for(var i = 0; i < R;i++){
			for(var j = 0;j < W;j++){
				var newDiv = document.createElement('div');
				newDiv.style.width = div[0].offsetWidth / R + 'px';
				newDiv.style.height = div[0].offsetHeight / W + 'px';
				newDiv.style.float = 'left';
				newDiv.style.background = 'rgb('+parseInt(Math.random()*256)+','+parseInt(Math.random()*256)+','+parseInt(Math.random()*256)+')';
				div[0].appendChild(newDiv);
			}
		};
	}
	

	onresize = function(){
		div[0].innerHTML = '',createNode(15,15);
		/*
		var smallDiv = div[0].querySelectorAll('div');
		for(var i = 0;i < smallDiv.length;i++){
			smallDiv[i].style.width = div[0].offsetWidth / R + 'px';
			smallDiv[i].style.height = div[0].offsetHeight / W + 'px';
		}
		*/
	}

</script>
</body>
</html>